<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script src="../js/vue.js"></script>
		<div id="app">
			<cpn></cpn>
			<cpn ref="aaa"></cpn>
			<button @click="btnClick">按钮</button>
		</div>
		<template id="cpn">
			<div>我是子组件</div>
		</template>
		<script>
			var app = new Vue({
				el: '#app',
				data: {

				},
				methods: {
					btnClick() {
						console.log(this.$children[0].showMessage())
						
						console.log(this.$refs.aaa.showMessage())
						console.log(this.$refs.aaa.name)
					}
				},
				components: {
					cpn: {
						template: "#cpn",
						data(){
							return {
								name:"啦啦啦啦啦"
							}
						},
						methods: {
							showMessage() {
								console.log("11111111111111")
							}
						}
					}
				}
			})
		</script>
	</body>
</html>
